home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODF-Interest Archive / June 96 / ContainingPartPropertiesUpdated < prev    next >
Encoding:
Internet Message Format  |  1996-12-03  |  2.8 KB  |  [TEXT/ttxt]

  1. Subject:     ContainingPartPropertiesUpdated
  2. Sent:        6/20/96 9:21 AM
  3. Received:    6/24/96 8:25 AM
  4. From:        Uwe Schoeneberg, odf@SoftGene.SpaceNet.de
  5. Reply-To:    ODF Interest, ODF-Interest@CILabs.ORG
  6. To:          OpenDoc Development Framework Discussion List, ODF-Interest@CILabs.
  7.  
  8. I find container properties very useful in my project.
  9.  
  10. In ODFd11 "ContainingPartPropertiesUpdated" had not yet been implemented.
  11. Following the descriptions in the OpenDoc Programmer's Guide ("Adopting
  12. Container Properties", p. 115; "Transmitting Your Container properties to
  13. Embedded Parts", p. 127) and since "FW_CODPart" wraps "ODPart" for us, I
  14. found it obvious to code "FW_CODPart::ContainingPartPropertiesUpdated" as
  15. follows:
  16.  
  17. FW_CODPart::ContainingPartPropertiesUpdated(...):
  18. {...
  19.  
  20.     FW_TRY
  21.     {
  22.         FW_CFrame* frame = FW_CFrame::ODtoFWFrame(ev, odFrame);
  23.         FW_ASSERT(frame);
  24.         FW_CPart* part = frame->GetPart(ev);    // no other way to retrieve
  25.                                                 // part from FW_CODPart ?
  26.         FW_ASSERT(part);
  27.         part->ContainingPartPropertiesUpdated(ev, odFrame, propertyUnit);
  28.     }
  29.     FW_CATCH_BEGIN
  30.  
  31. ...}
  32.  
  33. and then have the part adjust its properties in my overwrite to
  34. "FW_CPart::ContainingPartPropertiesUpdated". Here, I was iterating to all
  35. embedded parts to make sure changes get propagated down the hierarchy.
  36.  
  37. In ODF R1, "FW_CODPart" detours the flow via "FW_CFrame". In the overwrite
  38. to "FW_CFrame::ContainingPartPropertiesUpdated" I will have to grant
  39. "FW_CFrame" access to (otherwise private) part properties (unvealing their
  40. data structure) or to wrap accessors to them. Example:
  41.  
  42. void CMyPart::ContainingPartPropertiesUpdated(...)
  43. {...
  44.         fPropertyA->Adjust(...);
  45. ...}
  46.  
  47. becomes
  48.  
  49.         void CMyFrame::ContainingPartPropertiesUpdated(...)
  50.         {...
  51.                 CPropertyAType* propertyA = fCMyPart->GetPropertyA();
  52.                 propertyA->Adjust(...);
  53.         ...}
  54.  
  55.         CPropertyAType* CMyPart::GetPropertyA()
  56.         {
  57.                 return fPropertyA;
  58.         }
  59.  
  60. or
  61.  
  62.         void CMyFrame::ContainingPartPropertiesUpdated(...)
  63.         {...
  64.                 fCMyPart->AdjustPropertyA(...);
  65.         ...}
  66.  
  67.  
  68.         void CMyPart::AdjustPropertyA(...)
  69.         {
  70.                 fPropertyA->Adjust(...);
  71.         }
  72.  
  73. Both cases are difficult to maintain as more adjustable properties are
  74. added in later versions of my project.
  75.  
  76. The same thought applies to "AcquireContainingPartProperties".
  77.  
  78. Any reason I don't see for the detour in ODF R1?
  79.  
  80. Uwe Schoeneberg
  81.  
  82.  
  83. -----------------------------------------------------------------------------
  84. Soft Gene GmbH
  85. Offenbacher Str. 5
  86. 14 197 Berlin                                        Tel:    +49-30 841 71 50
  87. Germany                                              Fax:    +49-30 821 97 64
  88.  
  89.  
  90.  
  91.  
  92.